package hbt;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import app.*;
import app.dto.DetalleItemDto;
import dominio.*;


public class HibernateUtil {

	private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	 AnnotationConfiguration config = new AnnotationConfiguration();
        	 config.addAnnotatedClass(Cliente.class);
        	 config.addAnnotatedClass(Rodamiento.class);
        	 config.addAnnotatedClass(SolicitudCotizacion.class);
        	 config.addAnnotatedClass(ItemSolicitud.class);
        	 config.addAnnotatedClass(OrdenPedido.class);
        	 config.addAnnotatedClass(ItemPedido.class);
        	 config.addAnnotatedClass(Cotizacion.class);
        	 config.addAnnotatedClass(Contado.class);
        	 config.addAnnotatedClass(Financiado.class);
        	 config.addAnnotatedClass(Pais.class);
        	 config.addAnnotatedClass(Proveedor.class);
        	 config.addAnnotatedClass(ListaPrecios.class);
        	 config.addAnnotatedClass(ItemListaPrecios.class);
        	 config.addAnnotatedClass(CondicionDeVenta.class);
        	 config.addAnnotatedClass(PorFrecuencia.class);
        	 config.addAnnotatedClass(FormaPago.class);
        	 config.addAnnotatedClass(PorMonto.class);
        	 config.addAnnotatedClass(PorVolumen.class);
        	 config.addAnnotatedClass(Remito.class);
        	 config.addAnnotatedClass(CPR.class);
        	 config.addAnnotatedClass(Odv.class);
        	 config.addAnnotatedClass(DetalleItemDto.class);
        	 // agregado peligroso
        	 config.addAnnotatedClass(Factura.class);
           
             sessionFactory = config.buildSessionFactory();
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
 
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}
